﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;

namespace PeopleEntity
{
    public class PeopleBase
    {
        public PeopleBase(){}

        public PeopleBase(string name, DateTime birthDate, float weight, float height)
        {
            Height = height;
            Weight = weight;
            BirthDate = birthDate;
            Name = name;
            Id = Guid.NewGuid();
        }

        public Guid Id { get; private set; }
        public string Name { get; private set; }

        [DataType(DataType.Date)]
        [DisplayName("BirthDate")]
        [DisplayFormat(DataFormatString = "{0:DD MM YYYY}", ApplyFormatInEditMode = true)]
        [YearRange(MinYear = 1900,ErrorMessage = "Incorrect date")]
        public DateTime BirthDate { get; private set; }

        [Weight(MaxWeight = 150, ErrorMessage = "Incorrect weight")]
        [DisplayName("Weight (kg)")]
        public float Weight { get; private set; }

        [Height(MaxHeight = 3, ErrorMessage = "Incorrect height, it`s must be like x.xx")]
        [DisplayName("Height (m)")]
        public float Height { get; private set; }
    }
}
